import * as apis from '../../serve/actions'
import { __PUBLIC_PATH__ } from '../common'
import { Fetch, C } from './Fetch'

const api_base = __PUBLIC_PATH__

export const user_info: C<typeof apis.user_info> = () => Fetch(`${api_base}/user_info`)
export const user_all: C<typeof apis.user_all> = () => Fetch(`${api_base}/user_all`)

export const chatroom_list: C<typeof apis.chatroom_list> = (body) => Fetch(`${api_base}/chatroom_list`, body)
export const chatroom_info: C<typeof apis.chatroom_info> = (body) => Fetch(`${api_base}/chatroom_info`, body, undefined, true)
export const chatroom_create: C<typeof apis.chatroom_create> = (body) => Fetch(`${api_base}/chatroom_create`, body)
export const chatroom_update: C<typeof apis.chatroom_update> = (body) => Fetch(`${api_base}/chatroom_update`, body)
export const chatroom_adduser: C<typeof apis.chatroom_adduser> = (body) => Fetch(`${api_base}/chatroom_adduser`, body)
export const chatroom_deluser: C<typeof apis.chatroom_deluser> = (body) => Fetch(`${api_base}/chatroom_deluser`, body)
export const chatroom_updateuser: C<typeof apis.chatroom_updateuser> = (body) => Fetch(`${api_base}/chatroom_updateuser`, body)
export const chatroom_user_change: C<typeof apis.chatroom_user_change> = (body) => Fetch(`${api_base}/chatroom_user_change`, body)
export const chatroom_mute: C<typeof apis.chatroom_mute> = (body) => Fetch(`${api_base}/chatroom_mute`, body)
export const chatroom_delete: C<typeof apis.chatroom_delete> = (body) => Fetch(`${api_base}/chatroom_delete`, body)

export const log_all: C<typeof apis.log_all> = (body) => Fetch(`${api_base}/log_all`, body)
export const log_after_id: C<typeof apis.log_after_id> = (body) => Fetch(`${api_base}/log_all`, body)

export const message_send: C<typeof apis.message_send> = (body) => Fetch(`${api_base}/message_send`, body)
export const message_cancel: C<typeof apis.message_cancel> = (body) => Fetch(`${api_base}/message_cancel`, body)
